
define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Sales_manufactor, $ionicSlideBoxDelegate,GoPage) {
		
		$scope.selectIndex = 0;
		//手指滑动
		$scope.slideChanged = function(index) {
			$scope.selectIndex = index;
		};
		$scope.activeSlide = function(index) {
			$scope.selectIndex = index;
			$ionicSlideBoxDelegate.$getByHandle('main-handle').slide(index);
		};
		//数据获取
		Sales_manufactor.get_detail(function(data) {
			$scope.detail = data;
		});
		
		//页面跳转
		$scope.onshow_sales = function(index,id) {
			if(index==3) GoPage.go_states("d_add",{act_id:id});
			if(index==4)GoPage.go_states("promotion");
			if(index==5)GoPage.go_states("promotionaddup",{id:id});
			if(index==6)GoPage.go_states("d_add");
		}
		Sales_manufactor.get_mfacturer(1,1,function(data){
			$scope.doing = data;
		});
		Sales_manufactor.get_mfacturer(1,2,function(data){
			$scope.pending = data;
		});
		Sales_manufactor.get_mfacturer(1,3,function(data){
			$scope.ended = data;
		});

	}

	controller.$inject = ['$scope', 'Sales_manufactor', '$ionicSlideBoxDelegate','GoPage'];

	return app.registerController("sales_manufactorctrl",controller);
});